#include <iostream>

#include "DataStructure/Input/Element/ElementTypes.h"
#include "DataStructure/Input/Solver/DOFDirections.h"

#include "ElementActiveDOFs.h"

using SG::DataStructure::FEM::DofSet;
using SG::DataStructure::FEM::ElementTypes;
DofSet SG::DataStructure::FEM::getElementActiveDofs (const SG::DataStructure::FEM::ElementTypes type)
{
    DofSet dofset;
    switch (type)
    {
    // 只有线自由度的单元
    case ElementTypes::ELETYPE_Hexa8SRI:  // fall through
    case ElementTypes::ELETYPE_Penta6SRI:
    case ElementTypes::ELETYPE_Tetra4:
    case ElementTypes::ELETYPE_Shear: {
        dofset = DofSet{ DOFDirections::DOF_Ux, DOFDirections::DOF_Uy, DOFDirections::DOF_Uz };
        return dofset;
        break;
    }

    // 节点具有线位移和角位移的单元
    case ElementTypes::ELETYPE_Conm1:       // fall through
    case ElementTypes::ELETYPE_Conm2:       // fall through
    case ElementTypes::ELETYPE_Bush:        // fall through
    case ElementTypes::ELETYPE_Bar:         // fall through
    case ElementTypes::ELETYPE_Beam:        // fall through
    case ElementTypes::ELETYPE_ShellTria3:  // fall through
    case ElementTypes::ELETYPE_ShellQuad4: {
        dofset = DofSet{ DOFDirections::DOF_Ux,   DOFDirections::DOF_Uy,   DOFDirections::DOF_Uz,
                         DOFDirections::DOF_Rotx, DOFDirections::DOF_Roty, DOFDirections::DOF_Rotz };
        return dofset;
        break;
    }
    default:
        break;
    }

    // ELETYPE_Link & ELETYPE_LinkNoRef 这两种单元需要特别处理，不应该使用本函数
    std::cout << "SG::DataStructure::FEM::getEleActiveDofs havn't support this element type" << type;
    return dofset;
}

bool SG::DataStructure::FEM::isScalarElementType (const SG::DataStructure::FEM::ElementTypes type)
{
    return false;
}
